package com.springboot_gradrecruit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.springboot_gradrecruit.model.entity.Interview;
import com.springboot_gradrecruit.model.vo.interview.InterviewVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author zr
* @description 针对表【new】的数据库操作Mapper
* @createDate 2024-12-09 14:40:37
* @Entity generator.domain.New
*/
@Mapper
public interface InterviewMapper extends BaseMapper<Interview> {


    /**
     * 根据学生id查询面试信息，连表查询-面试表和岗位表
     */
    @Select("SELECT " +
            "i.interview_id,i.interview_url,i.interview_data,i.interview_status,i.interview_enterprise_id,i.interview_job_id,i.interview_desc, " +
            "j.job_company_name,j.job_title,j.job_salary,j.job_education_requirement,j.job_major_requirement,j.job_company_size,j.job_company_logo " +
            "FROM interview i " +
            "JOIN job j ON i.interview_job_id = j.job_id " +
            "WHERE i.interview_student_id = #{interviewStudentId}")
    List<InterviewVO> getInterviewWithJobById(@Param("interviewStudentId") Long interviewStudentId);

    /**
     * 根据企业id查询面试信息，连表查询-面试表和岗位表
     */
    @Select("SELECT " +
            "i.interview_id,i.interview_url,i.interview_data,i.interview_status,i.interview_is_offer,i.interview_enterprise_id,i.interview_job_id,i.interview_desc, " +
            "j.job_company_name,j.job_title,j.job_salary,j.job_education_requirement,j.job_major_requirement,j.job_company_size,j.job_company_logo " +
            "FROM interview i " +
            "JOIN job j ON i.interview_job_id = j.job_id " +
            "WHERE i.interview_enterprise_id = #{interviewEnterpriseId} and i.enterprise_is_deleted='未删除'")
    List<InterviewVO> getInterviewWithJobByIdByEnterpriseId(@Param("interviewEnterpriseId") Long interviewStudentId);


}




